parser grammar AnasintXML;

options {
  language = Java;
  tokenVocab = AnalexXML;
} 

@header {
  package Practica6.Ambiguedad;
}

@members {
  private ArrayList<String> errors = new ArrayList<String>();
  public void displayRecognitionError(String[] tokenNames, RecognitionException e) {
    String hdr = getErrorHeader(e);
    String msg = getErrorMessage(e, tokenNames);
    errors.add(hdr + " " + msg);
  }
   
  public ArrayList<String> getErrors() {
    return errors;
  }
}

entrada  : tag;
  
tag: iniTag (tag | PCDATA)* endTag; 
iniTag  : INIT_TAG ID (atributos)* FIN_TAG ;
atributos  : ID ATTR_EQ ATTR_VALUE ;
endTag :  OUT_TAG ID FIN_TAG ;  